This util was coded with Code Warrior Gold by Kaos of The Network.
The conversion information was supplied by Ian Vader & Mind Games, who without that help this program would not have been possible!!
For all dudes using this util, that wish to write a simular util for another platform (or maybe ya just think this sucks!), heres the info ya need. All info in black is taken from a original posting by Ian Vader to me, my programming comments are in red.
The number is in HEX in this format; XXXXXXXX
You split the number down the middle; XXXX XXXX
The 1st 4 Hex digits make the last 5 decimal digits of the 11 digit decimal No.
Hex digit number five ( ie. XXXX X XXX ) in decimal is digits 5 & 6 .
The last 3 Hex digits ( ie. XXXXX XXX ) are converted to binary. -
This gives a 12 digit binary number which is split down the middle.
Make two copies of this number (that is the 3 last hex digits), then bit clear the last 26 unused bits of the first copy - this gives us digits 3 & 4. Now take the second copy (totally unmodified by the last operation!!!!) and rotate the bits 6 places to the left, now bit clear the last 26 bits again - this gives us digits 1 & 2 . Piece a cake!! clearing the bits in this way is the same as turning the hex number to binary and using the 6 bits in the manner listed above. If ya cant see why doing this works then ya really shouldn't be attempting to write the util!!
The 1st 6 digits binary are converted to decimal to give digits 3 & 4 decimal.
The last 6 digits binary are converted to decimal to give digits 1 & 2 decimal.
That is then your 11 digit decimal number from the 8 digit Hex. Remember if you get any number not say 2 digits ie 00 normally on digits 5 and 6 decimal just put the zero in front.
Kaos
kaos@phreak.intermedia.co.uk
Programming history.
Version1.5 - Added the ability to convert ESN's from a file.
Version 2.0 - Found a bug !!! eek wot a good one too!! - It turned out that the 8 bytes of storage space I allocated for the HEX ESN was not disposed of if the contents turned out to be an invalid ESN. This meant running the util on a large file that had lots of invalid data would cause the heap to overflow. Wow MacSbug time and mega hang-up, even poor MacsBug could not help me out, and many a re-boot followed. arggghhh the joys of programming ;-)